package com.slz3.business.module.memberManagement.memMember.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memMember.domain.MemMember;
import com.slz3.business.module.memberManagement.memMember.domain.MemMemberFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemMemberTransactionalServiceImpl implements MemMemberTransactionalService {

    @Override
    public MemMember modify(MemMember memMemberNew) {
        Repositorys.memMember.test();
        Repositorys.memMember.save(MemMemberFactory.initBaseFields());
        System.err.println(1/0);
        memMemberNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memMember.saveAndFlush(memMemberNew);
    }

    @Override
    public List<MemMember> batchModify(List<MemMember> memMemberList) {
        return Repositorys.memMember.saveAll(memMemberList);
    }
}
